﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using University.Workshop.Model;
using University.Workshop.DataAccess;
using University.Workshop.Business;
using System.Web.Security;

namespace University.Workshop.WebApp
{
    public partial class TopicRegister : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!User.Identity.IsAuthenticated)
                FormsAuthentication.RedirectToLoginPage();
            LblCategory.Text = Request["category"];
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                TopicRegistrationManager.RegisterTopic(LblCategory.Text, Text.Text, User.Identity.Name);
                Response.Redirect("Topics.aspx?category=" + LblCategory.Text);
            }
            catch (Exception ex)
            {
                Label3.Text = ex.Message;
            }
        }
    }
}